home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / domacnost a kancelar / joomla / Joomla_1.5.4-Stable-Full_Package.exe / plugins / content / example.php < prev    next >
PHP Script  |  2008-07-06  |  4KB  |  149 lines

  1. <?php
  2. /**
  3.  * @version        $Id: example.php 10497 2008-07-03 16:36:12Z ircmaxell $
  4.  * @package        Joomla
  5.  * @subpackage    Content
  6.  * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  7.  * @license        GNU/GPL, see LICENSE.php
  8.  * Joomla! is free software. This version may have been modified pursuant
  9.  * to the GNU General Public License, and as distributed it includes or
  10.  * is derivative of works licensed under the GNU General Public License or
  11.  * other free or open source software licenses.
  12.  * See COPYRIGHT.php for copyright notices and details.
  13.  */
  14.  
  15. // Check to ensure this file is included in Joomla!
  16. defined( '_JEXEC' ) or die( 'Restricted access' );
  17.  
  18. jimport( 'joomla.plugin.plugin' );
  19.  
  20. /**
  21.  * Example Content Plugin
  22.  *
  23.  * @package        Joomla
  24.  * @subpackage    Content
  25.  * @since         1.5
  26.  */
  27. class plgContentExample extends JPlugin
  28. {
  29.  
  30.     /**
  31.      * Constructor
  32.      *
  33.      * For php4 compatability we must not use the __constructor as a constructor for plugins
  34.      * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  35.      * This causes problems with cross-referencing necessary for the observer design pattern.
  36.      *
  37.      * @param object $subject The object to observe
  38.      * @param object $params  The object that holds the plugin parameters
  39.      * @since 1.5
  40.      */
  41.     function plgContentExample( &$subject, $params )
  42.     {
  43.         parent::__construct( $subject, $params );
  44.     }
  45.  
  46.     /**
  47.      * Example prepare content method
  48.      *
  49.      * Method is called by the view
  50.      *
  51.      * @param     object        The article object.  Note $article->text is also available
  52.      * @param     object        The article params
  53.      * @param     int            The 'page' number
  54.      */
  55.     function onPrepareContent( &$article, &$params, $limitstart )
  56.     {
  57.         global $mainframe;
  58.  
  59.     }
  60.  
  61.     /**
  62.      * Example after display title method
  63.      *
  64.      * Method is called by the view and the results are imploded and displayed in a placeholder
  65.      *
  66.      * @param     object        The article object.  Note $article->text is also available
  67.      * @param     object        The article params
  68.      * @param     int            The 'page' number
  69.      * @return    string
  70.      */
  71.     function onAfterDisplayTitle( &$article, &$params, $limitstart )
  72.     {
  73.         global $mainframe;
  74.  
  75.         return '';
  76.     }
  77.  
  78.     /**
  79.      * Example before display content method
  80.      *
  81.      * Method is called by the view and the results are imploded and displayed in a placeholder
  82.      *
  83.      * @param     object        The article object.  Note $article->text is also available
  84.      * @param     object        The article params
  85.      * @param     int            The 'page' number
  86.      * @return    string
  87.      */
  88.     function onBeforeDisplayContent( &$article, &$params, $limitstart )
  89.     {
  90.         global $mainframe;
  91.  
  92.         return '';
  93.     }
  94.  
  95.     /**
  96.      * Example after display content method
  97.      *
  98.      * Method is called by the view and the results are imploded and displayed in a placeholder
  99.      *
  100.      * @param     object        The article object.  Note $article->text is also available
  101.      * @param     object        The article params
  102.      * @param     int            The 'page' number
  103.      * @return    string
  104.      */
  105.     function onAfterDisplayContent( &$article, &$params, $limitstart )
  106.     {
  107.         global $mainframe;
  108.  
  109.         return '';
  110.     }
  111.  
  112.     /**
  113.      * Example before save content method
  114.      *
  115.      * Method is called right before content is saved into the database.
  116.      * Article object is passed by reference, so any changes will be saved!
  117.      * NOTE:  Returning false will abort the save with an error.  
  118.      *     You can set the error by calling $article->setError($message)
  119.      *
  120.      * @param     object        A JTableContent object
  121.      * @param     bool        If the content is just about to be created
  122.      * @return    bool        If false, abort the save
  123.      */
  124.     function onBeforeContentSave( &$article, $isNew )
  125.     {
  126.         global $mainframe;
  127.  
  128.         return true;
  129.     }
  130.  
  131.     /**
  132.      * Example after save content method
  133.      * Article is passed by reference, but after the save, so no changes will be saved.
  134.      * Method is called right after the content is saved
  135.      *
  136.      *
  137.      * @param     object        A JTableContent object
  138.      * @param     bool        If the content is just about to be created
  139.      * @return    void        
  140.      */
  141.     function onAfterContentSave( &$article, $isNew )
  142.     {
  143.         global $mainframe;
  144.  
  145.         return true;
  146.     }
  147.  
  148. }
  149.